package com.settlement.system.common.enums;


import com.settlement.system.common.util.common.EnumUtil;

/**
 * 描述: 报表取值字段枚举 <br>
 *
 * @author: hc <br>
 * 创建时间: 2022.07.26 10:45 <br>
 * <br>
 */
public enum ReportValueEnum implements Code<String>{
    /** 0:【INT-发退货明细】_[商品数量] */
    INT_SEND_RETURN_QTY("【INT-发退货明细】_[商品数量]","om.qty"),
    //INT_SEND_RETURN__RETURN__QTY("【INT-发退货明细】_退货_[商品数量]","red.qty"),
    /** 1:【INT-发退货明细】_[结算金额] */
    INT_SEND_RETURN_SETTLEMENT_AMOUNT("【INT-发退货明细】_[结算金额]","om.amount"),
    //INT_SEND_RETURN__RETURN__SETTLEMENT_AMOUNT("【INT-发退货明细】_退货_[结算金额]","red.amount"),
    /** 2:【INT-仓出店店退仓报表】_[发退货数量] */
    INT_STORE_SEND_OR_RETURN_SEND_OUT_QTY("【INT-仓出店店退仓报表】_[发退货数量]","bd.send_out_qty"),
    //INT_STORE_SEND_OR_RETURN__RETURN__SEND_OUT_QTY("【INT-仓出店店退仓报表】_店退仓_[发退货数量]","-btd.send_out_qty"),
    /** 3:【INT-仓出店店退仓报表】_[销售金额] */
    INT_STORE_SEND_OR_RETURN__SEND__SALE_AMOUNT("【INT-仓出店店退仓报表】_[销售金额]","bd.sale_amount"),
    //INT_STORE_SEND_OR_RETURN__SRETURN__SALE_AMOUNT("【INT-仓出店店退仓报表】_店退仓_[销售金额]","-btd.send_out_qty * btd.sale_price"),

    ;
    /**
     * 名称
     */
    private final String name;
    /**
     * sql
     */
    private final String sql;

    ReportValueEnum(String name, String sql) {
        this.name = name;
        this.sql = sql;
    }

    public String getSql() {
        return sql;
    }

    /**
     * 获取对应的 ReportValueEnum
     * @param code code
     * @return 报表取值字段枚举
     */
    public static ReportValueEnum witch(String code){
        return EnumUtil.witch(code,ReportValueEnum.class,null);
    }


    @Override
    public String code() {
        return name;
    }
}
